package dd.prog2.exercises.set08;

public class Word implements Comparable<Word>{

	private String word;
	private int count;
	
	public Word(String word) {
		this.word = word;
		this.count = 1;
	}

	public int getCount() {
		return count;
	}

	public void setCount() {
		this.count ++;
	}

	public String getWord() {
		return this.word;
	}

	@Override
	public int compareTo(Word w) {
		if (this.getCount() < w.getCount())
            return -1; // this.Object smaller than w.Object
        else if (this.getCount() == w.getCount())
            return 0; // this = w
        else
            return 1; // this > w
	}
	
	
}
